package com.example.haojiutao.mapper;


import com.example.haojiutao.common.Result;
import com.example.haojiutao.model.domain.Collect;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;
/**
 * @Description: 收藏控制层
 * @Author: ma_lihong
 * @CreateTime: 2024/1/31 17:23
 */

@Mapper
public interface CollectMapper {

    /*
     * @Description: 根据用户 id 查询收藏列表
     * @Author: ma_lihong
     * @CreateTime: 2024/1/31 17:23
     * @param: userId
     * @return: java.util.List<com.example.haojiutao.model.domain.Collect>
     **/
    List<Collect> findByUserId(int userId);

    /*
     * @Description: // 商品id、用户id查询收藏信息
     * @Author: ma_lihong
     * @CreateTime: 2024/2/1 16:46
     * @param: collect
     * @return: com.example.haojiutao.model.domain.Collect
     **/
    Collect findCollect(Collect collect);

    /*
     * @Description: 取消收藏
     * @Author: ma_lihong
     * @CreateTime: 2024/2/1 16:46
     * @param: id
     * @return: int
     **/
    int deleteCollect(int id);

    // 商品详情页面，取消收藏
    int cancelCollect(Collect collect);

    /*
     * @Description: 收藏商品
     * @Author: ma_lihong
     * @CreateTime: 2024/1/31 17:20
     * @param: collect
     * @return: com.example.haojiutao.common.Result
     **/
    int addCollect(Collect collect);


    /*
     * @Description: 查询用户所有收藏
     * @Author: ma_lihong
     * @CreateTime: 2023/10/17 16:29
     * @param: collect
     * @return: com.example.haojiutao.common.Result
     **/
    List<Collect> selectCollect(Collect collect);

    Result isCollect(int goodsId);

    /*
     * @Description: 收藏商品
     * @Author: ma_lihong
     * @CreateTime: 2024/1/31 17:00
     * @param: collect
     * @return: com.example.haojiutao.common.Result
     **/
    Collect findCollect(int userId, int goodsId);

    /*
     * @Description: 根据,goodsId查看收藏该商品的信息
     * @Author: ma_lihong
     * @CreateTime: 2024/2/1 16:27
     * @param: goodsId
     * @return: com.example.haojiutao.common.Result
     **/
    List<Collect> getByGoodsId(int goodsId);

    /*
     * @Description: 获取收藏数
     * @Author: ma_lihong
     * @CreateTime: 2024/2/2 16:27
     * @param: userId
     * @return: com.example.haojiutao.common.Result
     **/
    Integer getCountByGoodsId(int goodsId);

    /*
     * @Description: 收藏更新
     * @Author: ma_lihong
     * @CreateTime: 2024/2/2 16:27
     * @param: collect
     * @return: com.example.haojiutao.common.Result
     **/
    void updateCollectStatus(Integer id);
}
